package com.zjitc.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016082600316198";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
  public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCJoiQZ3Faj5t/CNbQxpbrCVNSyiAxXwQN3SDTUQiUqpJIR6aWWn01SgZ60rf+xBt2es1b8qxCUGap+ZSInQM+fE7uiun03dErA220KRMcwYT4s8A4h10QyaDRbqPWKe6EpuPcQNcBiWjIwlGeWssU3WJiyIkuGk5UW2O2wJd+lpCTORs902i/KYeuycCfo16MysgbRyPgbK1TNGhNxLMtnZ8KWIAi48MX2PKVmdMxdE3WHXxeP2PnKiOwaRRRwOQX85aYBkg9qnS1gwGxe4MTaRfHn6+KXIUY9UoQum3F5txCybrRozyNmXoXaZ1uVPFT4IsSBt1/CH7yFD3mS4iwbAgMBAAECggEBAIMOTvwFEMcvf+AJjVU9L5H+fy6lV8Nz+l3p9swrVALABItkBZZgiJtI7Bu2F+S02fFVaj5ckgPEUNHccWIZV9ptSt2QYM2eQdRU3QbLKTULU84so/hbaAfrq/ef8nd0c6ksBK590HyW0HXrypv4DM0/4t60w2AZRf0kgWibF9Q8C9o0k7rLLJmlwlgfhZKwxJ4xMOUlydouI8UClhpxi1F8zcrt7SB1ZRrAC4KpjIzQqDa4Sd4hFD6ttcKM6Rm9Pyler3U+/UjgmNpUWlmF/YS7ndb0zxbQJkbS7aQf57N85XP2w7GOeF/K3vdw907PvILzwa9DOiXXjUqiTn6K+lECgYEAx679Q9vjXCVQtzWgcloPru/7LWAlFGP9mGfHTM8q0mDfOAgiouW3ovp7yXmHyrge7hnWcauA1ShjkzoFCcvzpvo4kUaLqMMMA3yyE4v6qXrB19DrMKnumP49llSu98qBe8LCmxMSp75NG9W+WYBCKnyoiSQuCifQqoMXF1tK7wMCgYEAsHMsESC7bcl6KBp3BScM8K8Bf1ZAOLr7QQdV58uRo1vAsQSvYIoyeOmPMCqFR9DRzbB9CDy8Qr6qMTGpDl4x9r/miZ/Bb6a8GlPHkonm/BDkW8fcFzEY4J5qt52Kaoy2DksQqJE2wjbBTGgwW7qgE09hphB/MSVa+Xek/zsXlwkCgYAyr1Uz8017pzEcv+zw+bE/a0SrWNswmMzW8YiiE3fAHLysIUyBYqPBJ6liE4oHR8L6Fu7avXifInhb938t5Gn9OUhAf9KVTKTxAabF1WMTv8gSOsJoAMpCZU5GqUocNXe2bVIuQKIcl+5EoXWGjEq/NBMndFqHU2Hg1hN3Z0HW9wKBgQCOLb+sbXuZk2djOS/+buD2b439VTqae9BJLegCxv2rbBtwiB3o5HKXC1vdq+WJYLIt07BsGsR347qvuRxH/46zDR5udtQfa3LWo/uEEKqXIeVgL0MhTOaG2B+VpNQL1yY7jjD2I0zEYeqP7sRIpbCm3qgIb/KNX1RXABlrr+nqQQKBgGl6SSDgcogk5H7Rg+I3b65WPUYqjhLuW6DoEgv3sR6B0r+5LRc1pfrZJ4rPEGDhruHL/2tQ8cXdE7lyHNL5PBSEi/L8nzC4TbgM3TR7Uh/JFllzVrHItPEL4e3QBJHEmHoINmAzqJHqyPAksuAiJc5xp8FFe7FHNWqR0LbkqPfR";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m6tCE8Utmv5LcplN51VKiA9U6GAdTHKf3o/lM4ocVc3ob0bzXZuQvKIBwPwGsaTNoD7bF8Giay28C/g9U6CjZQblr3QCvq5JkmHy2hKhHVK1Mhj5O8u2uajtLBstPHue5aiXLnuN6m1/Z/dVJKa6qTRsr9ePpm4vt/mRDB4dwivI154Z+WlHGwrZzo0UmJd4b8jqvB5RKUFURyC01oV/mpT42Rer6WjwRg+N5Amurc+ACelLDa9i0NLP2ydKXJ1zqHrsWi3vWZLMpj/T4Ev7GLAOLPau+/JXc+AQbTFU1TA+DhO9laazFt/dJpdmwF1O/5FptoFkUv4MeJXsPaSIQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alter.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

